<template>
  <div>
    <el-form :model="formInline" :rules="rules" class="demo-form-inline">
      <el-form-item>
        <el-input v-model="formInline.phone" placeholder="请输入供应商名称" clearable/>
      </el-form-item>
      <el-form-item>
        <el-input v-model="formInline.password" placeholder="请输入授权码" clearable show-password/>
      </el-form-item>
      <el-form-item>
        <el-checkbox v-model="data.remember">自动登录</el-checkbox>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" style="width:100%;" @click="onSubmit">进 入</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup lang='ts'>
import { reactive, ref, onMounted } from 'vue'
import {GVerify} from '@/utils/identify'
import { getCookie } from '@/utils/cookie';
import qs from 'qs';

const formInline = reactive({
  phone: '',
  password: '',
})
let data = reactive({
  remember:false,
})
const rules = reactive({
  phone: [
    { required: true, message: '请输入供应商名称', trigger: 'blur' }
  ],
  password: [
    { required: true, message: '请输入授权码', trigger: 'blur' }
  ]
})
let verifyCode = null

onMounted(()=>{
  verifyCode = new GVerify('v_container')
  if (getCookie('remember')) {
    data.remember = true;
    const info = qs.parse(getCookie('info'));
    formInline.phone = info.username;
    formInline.password = info.password;
  }
})

const onSubmit = () => {
  console.log('submit!')
}
</script>

<style lang='scss' scoped>
.verifyCodeItemCss{
  :deep(.el-form-item__content){
    display: flex;
    align-items: center;
  }
  #v_container{
    height: 40px;
  }
}
</style>
